<template>
  <div>
    <div class="swiper-container">
      <div class="swiper-wrapper category">
        <div class="swiper-slide ul">
          <li v-for="(item, index) in categoryAll.slice(0, 10)" :key="index" class="cate1">
            <img :src="item.img_url" alt="" />
          </li>
        </div>
        <div class="swiper-slide ul">
          <li v-for="(item, index) in categoryAll" :key="index" class="cate2">
            <img :src="item.img_url" />
          </li>
        </div>
      </div>
    </div>
    <!-- 导航条 -->
    <div class="navline">
      <ul>
        <li  v-for="(j,k) in 2" :key="k"></li>
      </ul>
    </div>
  </div>
</template>

<script>
import Swiper from "swiper";
// import "swiper/swiper.min.css"
export default {
  data() {
    return {
      categoryAll: [
        {
          img_explain: "图书",
          img_url:
            "http://img63.ddimg.cn/upload_img/00528/0000/tushu-1561292724.jpg",
        },
        {
          img_explain: "服装",
          img_url:
            "http://img60.ddimg.cn/upload_img/00528/0000/fuzhuang-1561292724.jpg",
        },
        {
          img_explain: "童书",
          img_url:
            "http://img61.ddimg.cn/upload_img/00528/0000/tongshu-1561292724.jpg",
        },
        {
          img_explain: "当当超市",
          img_url:
            "http://img60.ddimg.cn/upload_img/00463/22/jiuban-1625818091.png",
        },
        {
          img_explain: "新书榜",
          img_url:
            "http://img60.ddimg.cn/upload_img/00528/0000/xinshubang-1561292724.jpg",
        },
        {
          img_explain: "儿童街",
          img_url:
            "http://img63.ddimg.cn/ddimg/2229/ertongjiejiu-1623317725.png",
        },
        {
          img_explain: "电子书",
          img_url:
            "http://img61.ddimg.cn/upload_img/00528/0000/dianzhishu-1561292724.jpg",
        },
        {
          img_explain: "领券中心",
          img_url:
            "http://img61.ddimg.cn/upload_img/00528/0000/lijuanzhongxin-1561292724.jpg",
        },
        {
          img_explain: "文具",
          img_url:
            "http://img63.ddimg.cn/upload_img/00609/mao/xswj2x-1564646523.jpg",
        },
        {
          img_explain: "签到",
          img_url:
            "http://img61.ddimg.cn/upload_img/00528/0000/qiandao-1561292724.jpg",
        },
        {
          img_explain: "童书榜",
          img_url:
            "http://img61.ddimg.cn/upload_img/00528/000/11-tongshubang-1585645151.png",
        },
        {
          img_explain: "教辅",
          img_url:
            "http://img60.ddimg.cn/upload_img/00528/000/16-jiaopu-1585645151.png",
        },
        {
          img_explain: "独家特供",
          img_url:
            "http://img62.ddimg.cn/upload_img/00528/0000/13dujiategong-1585653062.png",
        },
        {
          img_explain: "小说",
          img_url:
            "http://img60.ddimg.cn/upload_img/00528/0000/14-xiaoshuo-1585653062.png",
        },
        {
          img_explain: "图书促销",
          img_url:
            "http://img61.ddimg.cn/upload_img/00528/0000/jinrichuxiao-1561292724.jpg",
        },
        {
          img_explain: "文学",
          img_url:
            "http://img61.ddimg.cn/upload_img/00528/0000/16-wenxue-1585653062.png",
        },
        {
          img_explain: "当当直播",
          img_url:
            "http://img61.ddimg.cn/upload_img/00528/000/14-dangdangzhibo-1585645151.png",
        },
        {
          img_explain: "历史",
          img_url:
            "http://img60.ddimg.cn/upload_img/00528/000/19-lishi-1585645151.png",
        },
        {
          img_explain: "特价书市",
          img_url:
            "http://img63.ddimg.cn/upload_img/00528/000/15-tejiashushi-1585645151.png",
        },
        {
          img_explain: "食品",
          img_url:
            "http://img62.ddimg.cn/upload_img/00528/000/6-3shiping-1563846566.jpg",
        },
      ],
      category: null,
      style: 1,
      // swiper: null,
    };
  },
  mounted() {
    new Swiper(".swiper-container", {
      autoHeight: true, //enable auto height
      spaceBetween: 20,
    });
  },
  created() {},
  watch: {
    // vant: function (event) {
    //   console.log(event);
    // },
  },
};
</script>

<style lang="less" scoped>
.swiper-container {
  width: 100%;
  height: auto;
}

.swiper-slide {
  text-align: center;
  font-size: 18px;
  background: #fff;
}

// .swiper-container .swiper-slide {
//   height: 150px;
//   line-height: 150px;
// }

// .swiper-container .swiper-slide:nth-child(2n) {
//   height: 300px;
//   line-height: 300px;
// }
.category {
  background-color: white;
  height: auto;
  .ul {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    li {
      width: 20%;
      //   margin: 5px 0px;
      img {
        width: 100%;
      }
    }
  }
}

.navline {
  height: 27px;
  display: flex;
  justify-content: center;
  ul {
    margin-top: 10px;
    display: flex;
    li {
      width: 13px;
      height: 2px;
      background-color: #eeedea;
      margin: 0px;
      &.active {
        background-color: #303439;
        border: 1px solid white;
        margin: 0px 1px;
      }
    }
  }
}
</style>